package SMUVE;

public class Item {
	private String name;
	private String desc;
	private String location;
	private boolean in_room;
	private boolean locked;
	private static final String delimiter = SMUVE.Msg_Pipe.delimiter;

	public Item(String name, String location, String desc, boolean in_room) {
		this.name = name;
		this.desc = desc;
		this.location = location;
		this.in_room = in_room;
	}

	public String get_description() {
		return(desc);
	}

	public void set_description(String desc)
	{
		this.desc=desc;
	}
	
	public String get_name() {
		return(name);
	}

	public void set_name(String name){
		this.name=name;
	}
	
	public String get_location() {
		return(location);
	}
	
	public void set_location(String location)
	{
		this.location=location;
	}

	public boolean held() {
		return(!in_room);
	}

	public boolean lock() {
		locked = true;

		return(locked);
	} 

	public boolean unlock() {
		locked = false;

		return(locked);
	}

	public boolean is_locked() {
		return(locked);
	}

	public boolean pick_up(String player) {
		boolean retval = false;

		if (!locked) {
			location = player;
			in_room = false;
			retval = true;
		}

		return(retval);
	}
	
	public boolean put_down(String room) {
		location = room;
		in_room = true;

		return(true);
	}

	public boolean set_in_room(boolean in_room) {
		return(this.in_room = in_room);
	}

	public boolean get_in_room() {
		return(in_room);
	}
	public String toString()
	{
		return(name + delimiter + desc + delimiter + location + delimiter + in_room + delimiter + locked);
	}
}
